home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / SCRIPT.PAK / EDIT.SPP < prev    next >
Text File  |  1997-05-06  |  53KB  |  2,146 lines

  1. //----------------------------------------------------------------------------
  2. // cScript
  3. // (C) Copyright 1995, 1997 by Borland International, All Rights Reserved
  4. //
  5. // EDIT.SPP
  6. //    Script component of IDE's Editor editor class.
  7. //    Provides support services for editing environment.
  8. //
  9. // $Revision:   1.161  $
  10. //
  11. //----------------------------------------------------------------------------
  12.  
  13. //----------------------------------------------------------------------------
  14. // Symbol Imports
  15. //----------------------------------------------------------------------------
  16.  
  17. import IDE;
  18. import scriptEngine;
  19.  
  20. // mark this module as being a library module
  21. library;
  22.  
  23. //----------------------------------------------------------------------------
  24. // Symbol Exports
  25. //----------------------------------------------------------------------------
  26.  
  27. export editor = new Editor();
  28. export bPopEditorKeyboard = false;
  29.  
  30. //----------------------------------------------------------------------------
  31. // Symbol Loads
  32. //----------------------------------------------------------------------------
  33.  
  34. scriptEngine.SymbolLoad("ED_BRIEF", "briefEmulation");
  35. scriptEngine.SymbolLoad("ED_CLSSC", "classicEmulation");
  36. scriptEngine.SymbolLoad("ED_DFLT", "defaultEmulation");
  37. scriptEngine.SymbolLoad("ED_EPSLN", "epsilonEmulation");
  38.  
  39. //----------------------------------------------------------------------------
  40. // Symbol Defines
  41. //----------------------------------------------------------------------------
  42.  
  43. #define BOOKMARK_ID_SYSTEM_ONE   19
  44. #define BOOKMARK_ID_SYSTEM_TWO   18
  45. #define BOOKMARK_ID_SYSTEM_THREE 17
  46.  
  47. declare gbStyle = EXCLUSIVE_BLOCK;
  48.  
  49. //----------------------------------------------------------------------------
  50. // Methods altering the current position of the cursor.
  51. //----------------------------------------------------------------------------
  52.  
  53. //
  54. // Move the cursor to the begining of the mark.
  55. //
  56. on editor:>MoveCursorToMarkBegin() {
  57.    declare eb = .BlockExists();
  58.    if (eb != NULL) {
  59.       eb.Save();
  60.       .TopView.Position.Move(eb.StartingRow, eb.StartingColumn);
  61.       eb.Restore();
  62.         } else {
  63.       IDE.ReportError("Mark not selected");
  64.    }
  65. }
  66.  
  67. //
  68. // Move the cursor to the end of the mark.
  69. //
  70. on editor:>MoveCursorToMarkEnd() {
  71.    declare eb = .BlockExists();
  72.    if (eb != NULL) {
  73.       eb.Save();
  74.       .TopView.Position.Move(eb.EndingRow, eb.EndingColumn);
  75.       eb.Restore();
  76.    } else {
  77.       IDE.ReportError("Mark not selected");
  78.    }
  79. }
  80.  
  81. //
  82. // Move the cursor to the coressponding brace.
  83. //
  84. on editor:>MoveCursorToMate(defaultDir) {
  85.    LoadMateFunctionality();
  86.    .Mate(defaultDir);
  87. }
  88.  
  89. //
  90. // Move the cursor to the left of the current word.
  91. //
  92. on editor:>MoveCursorToWordLeft() {
  93.  
  94.    declare ep = .TopView.Position;
  95.  
  96.    if (ep.Column == 1) {
  97.        declare nRow = ep.Row;
  98.        ep.MoveRelative(-1,0);
  99.        if (ep.Row != nRow)
  100.            ep.MoveEOL();
  101.    } else {
  102.       ep.MoveCursor(SKIP_LEFT | SKIP_NONWORD);
  103.       ep.MoveCursor(SKIP_LEFT | SKIP_WORD);
  104.    }
  105. }
  106.  
  107. //
  108. // Move the cursor to the right of the current word.
  109. //
  110. on editor:>MoveCursorToWordRight() {
  111.  
  112.    declare ep = .TopView.Position;
  113.  
  114.    if (ep.Character == 13) {
  115.        declare nRow = ep.Row;
  116.        ep.MoveRelative(1,0);
  117.        if (ep.Row != nRow)
  118.            ep.Move(0,1);
  119.    } else {
  120.       ep.MoveCursor(SKIP_RIGHT | SKIP_WORD);
  121.       ep.MoveCursor(SKIP_RIGHT | SKIP_NONWORD);
  122.    }
  123. }
  124.  
  125. //----------------------------------------------------------------------------
  126. // Methods altering the position of the cursor while marking.
  127. //----------------------------------------------------------------------------
  128.  
  129. //
  130. // While marking, move to the begining of the file.
  131. //
  132. on editor:>MarkToBOF() {
  133.    declare eb = .BlockExists();
  134.  
  135.    if (eb == NULL) {
  136.       eb = .TopView.Block;
  137.       eb.Begin();
  138.       SetBlockStyle(gbStyle);
  139.    }
  140.  
  141.    eb.Extend(1,1);
  142. }
  143.  
  144. //
  145. // While marking, move to the begining of the line.
  146. //
  147. on editor:>MarkToBOL(declare nBlockStyle) {
  148.    declare eb = .BlockExists();
  149.  
  150.    if (eb == NULL) {
  151.       eb = .TopView.Block;
  152.       eb.Begin();
  153.  
  154.       if (!initialized(nBlockStyle))
  155.          nBlockStyle = gbStyle;
  156.  
  157.       SetBlockStyle(nBlockStyle);
  158.    }
  159.  
  160.    eb.Extend(.TopView.Position.Row, 1);
  161. }
  162.  
  163. //
  164. // While marking, move to the end of the file.
  165. //
  166. on editor:>MarkToEOF() {
  167.    declare eb = .BlockExists();
  168.    declare ep = .TopView.Position;
  169.  
  170.    if (eb == NULL) {
  171.       eb = .TopView.Block;
  172.       eb.Begin();
  173.       SetBlockStyle(gbStyle);
  174.    }
  175.  
  176.    eb.Save();
  177.    ep.Save();
  178.    ep.MoveEOF();
  179.    declare endRow = ep.Row;
  180.    declare endCol = ep.Column;
  181.    ep.Restore();
  182.    eb.Restore();
  183.  
  184.    eb.Extend(endRow, endCol);
  185. }
  186.  
  187. //
  188. // While marking, move to the end of the line.
  189. //
  190. on editor:>MarkToEOL(declare nBlockStyle) {
  191.    declare eb = .BlockExists();
  192.    declare ep = .TopView.Position;
  193.  
  194.    if (eb == NULL) {
  195.       eb = .TopView.Block;
  196.       eb.Begin();
  197.  
  198.       if (!initialized(nBlockStyle))
  199.           nBlockStyle = gbStyle;
  200.  
  201.       SetBlockStyle(nBlockStyle);
  202.    }
  203.  
  204.    eb.Save();
  205.    ep.Save();
  206.    ep.MoveEOL();
  207.    declare endRow = ep.Row;
  208.    declare endCol = ep.Column;
  209.    ep.Restore();
  210.    eb.Restore();
  211.  
  212.    eb.Extend(endRow, endCol);
  213. }
  214.  
  215. //
  216. // Move to specified location relative to the current location.
  217. //
  218. on editor:>MarkToRelative(declare deltaRow, declare deltaCol) {
  219.    declare eb = .BlockExists();
  220.  
  221.    if (eb == NULL) {
  222.        eb = BeginBlock(gbStyle);
  223.     }
  224.  
  225.    eb.ExtendRelative(deltaRow, deltaCol);
  226. }
  227.  
  228. //
  229. // While marking, move down one page.
  230. //
  231. on editor:>MarkToPageDown() {
  232.    declare eb = .BlockExists();
  233.  
  234.    if (eb == NULL) {
  235.       eb = BeginBlock(gbStyle,false);
  236.    }
  237.  
  238.    eb.ExtendPageDown();
  239. }
  240.  
  241. //
  242. // While marking, move up one page.
  243. //
  244. on editor:>MarkToPageUp() {
  245.    declare eb = .BlockExists();
  246.  
  247.    if (eb == NULL) {
  248.       eb = .TopView.Block;
  249.       eb.Reset();
  250.       eb.Begin();
  251.       SetBlockStyle(gbStyle);
  252.         }
  253.  
  254.    eb.ExtendPageUp();
  255. }
  256.  
  257. //
  258. // While marking, move to the bottom of the current views window.
  259. //
  260. on editor:>MarkToViewBottom() {
  261.    declare eb = .BlockExists();
  262.  
  263.    if (eb == NULL) {
  264.       eb = .TopView.Block;
  265.       eb.Begin();
  266.       SetBlockStyle(gbStyle);
  267.    }
  268.  
  269.    if (.TopView.BottomRow)
  270.       eb.Extend(.TopView.BottomRow-1, .TopView.Position.Column);
  271.    else
  272.       eb.Extend(.TopView.BottomRow, .TopView.Position.Column);
  273. }
  274.  
  275. //
  276. // While marking, move to the top of the current views window.
  277. //
  278. on editor:>MarkToViewTop() {
  279.    declare eb = .BlockExists();
  280.  
  281.    if (eb == NULL) {
  282.       eb = .TopView.Block;
  283.       eb.Begin();
  284.       SetBlockStyle(gbStyle);
  285.    }
  286.  
  287.    eb.Extend(.TopView.TopRow, .TopView.Position.Column);
  288. }
  289.  
  290. //
  291. // While marking, move to the left of the current word.
  292. //
  293. on editor:>MarkToWordLeft(declare bWithDelete) {
  294.    declare eb = .BlockExists();
  295.    declare ep = .TopView.Position;
  296.  
  297.    if (eb == NULL) {
  298.       eb = .TopView.Block;
  299.       SetBlockStyle(gbStyle);
  300.    }
  301.  
  302.    ep.Save();
  303.    eb.Save();
  304.    .MoveCursorToWordLeft();
  305.    declare nRow = ep.Row;
  306.    declare nColumn = ep.Column;
  307.    ep.Restore();
  308.    eb.Restore();
  309.    eb.Extend(nRow, nColumn);
  310.  
  311.    if (bWithDelete) {
  312.       eb.Cut();
  313.    }
  314. }
  315.  
  316. //
  317. // While marking, move to the right of the current word.
  318. //
  319. on editor:>MarkToWordRight(declare bWithDelete) {
  320.    declare eb = .BlockExists();
  321.    declare ep = .TopView.Position;
  322.  
  323.    if (eb == NULL) {
  324.        eb = .TopView.Block;
  325.    }
  326.  
  327.    if (eb.Size == 0) {
  328.       ResetBlock();
  329.       BeginBlock(gbStyle);
  330.    }
  331.  
  332.    ep.Save();
  333.  
  334.    if (bWithDelete)
  335.       ep.Save();
  336.  
  337.    eb.Save();
  338.  
  339.    .MoveCursorToWordRight();
  340.  
  341.    declare nRow = ep.Row;
  342.    declare nColumn = ep.Column;
  343.  
  344.    ep.Restore();
  345.    eb.Restore();
  346.  
  347.    eb.Extend(nRow, nColumn);
  348.  
  349.    if (bWithDelete) {
  350.       eb.Cut();
  351.       ep.Restore();
  352.    }
  353. }
  354.  
  355. //----------------------------------------------------------------------------
  356. // Methods altering the position of the cursor while using modal
  357. // blocking.
  358. //----------------------------------------------------------------------------
  359.  
  360. //
  361. // Move the cursor to the begining of the file, extending the block.
  362. //
  363. on editor:>ModalMoveBOF() {
  364.    declare eb = .BlockExists();
  365.    if (eb != NULL) {
  366.       return .MarkToBOF();
  367.    }
  368.  
  369.    .TopView.Position.Move(1,1);
  370. }
  371.  
  372. //
  373. // Move the cursor to the begining of the line, extending the block.
  374. //
  375. on editor:>ModalMoveBOL() {
  376.    declare eb = .BlockExists();
  377.    if (eb != NULL) {
  378.       return .MarkToBOL();
  379.    }
  380.  
  381.    return .TopView.Position.MoveBOL();
  382. }
  383.  
  384. //
  385. // Move the cursor to the end of the file, extending the block.
  386. //
  387. on editor:>ModalMoveEOF() {
  388.    declare eb = .BlockExists();
  389.    if (eb != NULL) {
  390.                 return .MarkToEOF();
  391.    }
  392.  
  393.    .TopView.SetTopLeft(0,1);
  394.    .TopView.Position.MoveEOF();
  395. }
  396.  
  397. //
  398. // Move the cursor to the end of the line, extending the block.
  399. //
  400. on editor:>ModalMoveEOL() {
  401.    declare eb = .BlockExists();
  402.    if (eb != NULL) {
  403.       return .MarkToEOL();
  404.    }
  405.  
  406.    return .TopView.Position.MoveEOL();
  407. }
  408.  
  409. //
  410. // Move the cursor to the specified line, extending the block.
  411. //
  412. on editor:>ModalMoveToLine(declare lineNum) {
  413.  
  414.    declare ep = .TopView.Position;
  415.    declare eb = .BlockExists();
  416.  
  417.    if (eb != NULL) {
  418.       ep.Save();
  419.       eb.Save();
  420.    }
  421.  
  422.    if (initialized(lineNum))
  423.       ep.MoveRelative(lineNum,0);
  424.    else {
  425.       ep.GotoLine();
  426.    }
  427.  
  428.    if (eb != NULL) {
  429.       declare row = ep.Row;
  430.       declare column = ep.Column;
  431.       ep.Restore();
  432.       eb.Restore();
  433.       eb.Extend(row, column);
  434.    }
  435. }
  436.  
  437. //
  438. // Move the cursor to the specified position relative to the current
  439. // location, extending the block.
  440. //
  441. on editor:>ModalMoveRelative(deltaRow, deltaColumn) {
  442.  
  443.    declare eb = .BlockExists();
  444.  
  445.    if (eb != NULL) {
  446.       return eb.ExtendRelative(deltaRow, deltaColumn);
  447.    }
  448.  
  449.    return .TopView.Position.MoveRelative(deltaRow, deltaColumn, true);
  450. }
  451.  
  452. //
  453. // Move the cursor to the bottom of the current screen view, extending
  454. // the block.
  455. //
  456. on editor:>ModalMoveViewBottom() {
  457.    declare eb = .BlockExists();
  458.    if (eb != NULL) {
  459.       return .MarkToViewBottom();
  460.    }
  461.  
  462.    .TopView.Position.Move(.TopView.BottomRow-1);
  463. }
  464.  
  465. //
  466. // Move the cursor to the top of the current screen view, extending
  467. // the block.
  468. //
  469. on editor:>ModalMoveViewTop() {
  470.    declare eb = .BlockExists();
  471.    if (eb != NULL) {
  472.       return .MarkToViewTop();
  473.    }
  474.  
  475.    .TopView.Position.Move(.TopView.TopRow);
  476. }
  477.  
  478. //
  479. // Move the cursor down one page, extending the block.
  480. //
  481. on editor:>ModalPageDown() {
  482.    declare ep = .TopView.Position;
  483.    declare eb = .BlockExists();
  484.  
  485.    if (eb != NULL) {
  486.       ep.Save();
  487.       eb.Save();
  488.    }
  489.  
  490.    .TopView.PageDown();
  491.  
  492.    if (eb != NULL) {
  493.       declare row = ep.Row;
  494.       declare column = ep.Column;
  495.       ep.Restore();
  496.       eb.Restore();
  497.       eb.Extend(row, column);
  498.    }
  499. }
  500.  
  501. //
  502. // Move the cursor up one page, extending the block.
  503. //
  504. on editor:>ModalPageUp() {
  505.    declare ep = .TopView.Position;
  506.    declare eb = .BlockExists();
  507.  
  508.    if (eb != NULL) {
  509.       ep.Save();
  510.       eb.Save();
  511.    }
  512.  
  513.    .TopView.PageUp();
  514.  
  515.    if (eb != NULL) {
  516.       declare row = ep.Row;
  517.       declare column = ep.Column;
  518.       ep.Restore();
  519.       eb.Restore();
  520.       eb.Extend(row, column);
  521.    }
  522. }
  523.  
  524. //
  525. // Delete word to the left.
  526. //
  527. on editor:>ModalMarkToWordLeft(declare bWithDelete) {
  528.    // declare variables.
  529.    declare eb = .TopView.Block;
  530.    declare ep = .TopView.Position;
  531.  
  532.    eb.End();
  533.  
  534.    .MoveCursorToWordLeft();
  535.  
  536.    eb.Begin();
  537.  
  538.    if (bWithDelete)
  539.       eb.Cut();
  540. }
  541.  
  542. //
  543. // Delete word to the right.
  544. //
  545. on editor:>ModalMarkToWordRight(declare bWithDelete) {
  546.    // declare variables.
  547.    declare eb = .TopView.Block;
  548.    declare ep = .TopView.Position;
  549.  
  550.    eb.Begin();
  551.  
  552.    .MoveCursorToWordRight();
  553.  
  554.    eb.End();
  555.  
  556.    if (bWithDelete)
  557.       eb.Cut();
  558. }
  559.  
  560.  
  561. //----------------------------------------------------------------------------
  562. // Methods for controlling Views, Windows and Buffers.
  563. //----------------------------------------------------------------------------
  564.  
  565. //
  566. // Creates a new view in the specified direction.
  567. //
  568. declare gewClassExpert = NULL;
  569.  
  570. on editor:>CreateView(declare direction) {
  571.  
  572.    declare ew = .TopView.Window;
  573.  
  574.    if (initialized(ew))
  575.        if (ew != gewClassExpert) {
  576.  
  577.             declare evNew = ew.ViewCreate(direction);
  578.  
  579.             if (initialized(evNew))
  580.                 if (evNew != NULL){
  581.                     declare evOrg = .TopView;
  582.                     declare ep = evNew.Position;
  583.                                                   ep.Move(evOrg.Position.Row, evOrg.Position.Column);
  584.                                                   IDE.ViewActivate(direction);
  585.                                                   return evNew;
  586.                 }
  587.        }
  588.  
  589.    return false;
  590. }
  591.  
  592. //
  593. // Delete view in the specified direction.
  594. //
  595. on editor:>DeleteView(declare direction) {
  596.  
  597.    if (initialized(.TopView)) {
  598.        if (.TopView != NULL) {
  599.            if (initialized(.TopView.Window)) {
  600.                declare ew = .TopView.Window;
  601.  
  602.                if (ew != NULL && ew != gewClassExpert)
  603.                    return ew.ViewDelete(direction);
  604.            }
  605.        }
  606.    }
  607.  
  608.    return false;
  609. }
  610.  
  611. //
  612. // Scroll the editor's current line by the specified magnitude,
  613. // extending the block.
  614. //
  615. on editor:>ModalScroll(declare magnitude) {
  616.  
  617.    declare ep = .TopView.Position;
  618.    declare eb = .BlockExists();
  619.  
  620.    if (eb != NULL) {
  621.       ep.Save();
  622.       eb.Save();
  623.    }
  624.  
  625.    .TopView.Scroll(magnitude);
  626.  
  627.    if (ep.Row >= .TopView.BottomRow) {
  628.       ep.Move(ep.Row - 1, ep.Column);
  629.       .TopView.MoveViewToCursor();
  630.    }
  631.  
  632.    if (ep.Row < .TopView.TopRow) {
  633.       ep.Move(ep.Row + 1, ep.Column);
  634.       .TopView.MoveViewToCursor();
  635.    }
  636.  
  637.    if (eb != NULL) {
  638.       declare row = ep.Row;
  639.       declare column = ep.Column;
  640.       ep.Restore();
  641.       eb.Restore();
  642.       eb.Extend(row, column);
  643.    }
  644. }
  645.  
  646. //
  647. // Reposition the editor's current line to the bottom of the current
  648. // view.
  649. //
  650. on editor:>MoveLineViewBottom() {
  651.    declare ev  = .TopView;
  652.    declare row = ev.Position.Row;
  653.    declare topRow = ev.TopRow;
  654.    declare bottomRow = ev.BottomRow;
  655.    declare height = bottomRow - topRow;
  656.    if (row > height)
  657.       ev.SetTopLeft(row - (height - 1));
  658. }
  659.  
  660. //
  661. // Reposition the editor's current line to the top of the current
  662. // view.
  663. //
  664. on editor:>MoveLineViewTop() {
  665.    declare ev = .TopView;
  666.    declare row = ev.Position.Row;
  667.    ev.SetTopLeft(row);
  668. }
  669.  
  670. //
  671. // Reposition the editor's current line to the center of
  672. // the current view.
  673. //
  674. on editor:>MoveLineViewCenter() {
  675.    declare ev = .TopView;
  676.    declare row = ev.Position.Row;
  677.    ev.Center(row);
  678. }
  679.  
  680. //
  681. // Replace the EditBuffer being viewed in the top level EditView with
  682. // a new EditBuffer.
  683. //
  684. // This method is invoked by the IDE in response to source file navigation
  685. // from the MessageView, Debugger and Browser when the Options|Environment|
  686. // Preferences|Source Tracking option is set to 'Current Window'
  687. //
  688. on editor:>NewView(declare fn, declare forcePrompt) {
  689.    declare msg;
  690.  
  691.    if(!initialized(forcePrompt))
  692.       forcePrompt = false;
  693.  
  694.    // prompt for the filename if necessary
  695.    if (!IDE.IsLegalFileName(fn)) {
  696.       fn = ContextSensitiveFileDialog("EditFile", "Open File (into pane):", "*.*");
  697.    }else if(forcePrompt != 0){
  698.       fn = ContextSensitiveFileDialog("EditFile", "Open File (into pane):", fn);
  699.    }
  700.  
  701.    if (IDE.IsLegalFileName(fn)) {
  702.  
  703.       declare newBuf = new EditBuffer(fn);
  704.       if (newBuf == NULL) {
  705.          IDE.ReportError("Unable to create new edit buffer");
  706.          return;
  707.       }
  708.       if (newBuf.IsValid == FALSE) {
  709.          IDE.ReportError("Unable to create new edit buffer");
  710.          return;
  711.       }
  712.  
  713.       declare theView = .TopView;
  714.       declare replaceExisting = false;
  715.       if (theView != NULL){
  716.          if(theView.IsValid == TRUE) {
  717.             replaceExisting = true;
  718.          }
  719.       }
  720.  
  721.       if(replaceExisting){
  722.          if(theView.Attach(newBuf) == NULL){
  723.             // the Attach will fail if the TopView is a editor embedded within 
  724.             // the ClassExpert.  In this case we will bring up an entierly new 
  725.             // window.
  726.             IDE.DoFileOpen(fn, "Text Edit");
  727.          }
  728.       }else{                               
  729.          // use DoFileOpen in order to ensure that the buffer will be opened
  730.          // regardless of the file's existence.
  731.          IDE.DoFileOpen(fn, "Text Edit");
  732.       }
  733.  
  734.       if (IDE.FileExists(fn))
  735.          msg = FormatString("Buffer \"%1\" opened", fn);
  736.       else
  737.          msg = FormatString("Buffer \"%1\" created", fn);
  738.  
  739.       IDE.StatusBar = msg;
  740.    }
  741. }
  742.  
  743. //
  744. // Switch to the next window.
  745. //
  746. on editor:>NextWindow() {
  747.    if(.GetWindow() != NULL){
  748.       declare ew = .GetWindow();
  749.  
  750.       if (initialized(ew)) {
  751.           ew = ew.Next;
  752.  
  753.           if (ew != NULL) {
  754.               ew.Activate();
  755.           }
  756.       }
  757.    }
  758. }
  759.  
  760. //
  761. // Switch to the next view.
  762. //
  763. on editor:>NextView() {
  764.    if (editor.TopView != NULL){
  765.       editor.TopView.Next.Window.ViewActivate(0, editor.TopView.Next);
  766.    }
  767. }
  768.  
  769. //
  770. // Scroll the editor's current line by the specified magnitude.
  771. //
  772. on editor:>Scroll(declare magnitude) {
  773.    declare ep = .TopView.Position;
  774.  
  775.    .TopView.Scroll(magnitude);
  776.  
  777.    if (ep.Row >= .TopView.BottomRow) {
  778.       ep.Move(ep.Row - 1, ep.Column);
  779.       .TopView.MoveViewToCursor();
  780.    }
  781.  
  782.    if (ep.Row < .TopView.TopRow) {
  783.       ep.Move(ep.Row + 1, ep.Column);
  784.       .TopView.MoveViewToCursor();
  785.    }
  786. }
  787.  
  788. //
  789. // Slide a view from the specified direction.
  790. //
  791. on editor:>SlideView(declare direction) {
  792.    if (initialized(.TopView.Window))
  793.       return .TopView.Window.ViewSlide(direction);
  794. }
  795.  
  796. //
  797. // Switch to the previous window.
  798. //
  799. on editor:>PreviousWindow() {
  800.    if(.GetWindow() != NULL){
  801.       declare ew = .GetWindow();
  802.  
  803.       if (initialized(ew)) {
  804.           ew = ew.Prior;
  805.           if (ew != NULL) {
  806.               ew.Activate();
  807.          }
  808.       }
  809.    }
  810. }
  811.  
  812. //
  813. // Switch to the next view.
  814. //
  815. on editor:>PreviousView() {
  816.  
  817.    if (editor.TopView != NULL){
  818.       editor.TopView.Prior.Window.ViewActivate(0, editor.TopView.Prior);
  819.    }
  820. }
  821.  
  822. //
  823. // Toggles the current zoom state of the current view.
  824. //
  825. on editor:>ToggleWindowState() {
  826.  
  827.    declare State = IDE.GetWindowState();
  828.    if (State == SW_MAXIMIZE)
  829.       IDE.SetWindowState(SW_RESTORE);
  830.    else
  831.       IDE.SetWindowState(SW_MAXIMIZE);
  832. }
  833.  
  834. //----------------------------------------------------------------------------
  835. // Methods for controlling behavior of Cut/Copy/Paste/Delete/Move.
  836. //----------------------------------------------------------------------------
  837.  
  838. on editor:>Delete() {
  839.    declare eb = .BlockExists();
  840.    if (eb != NULL) {
  841.       if (eb.Size != 0) {
  842.           RemoveBlock(eb,TRUE);
  843.           IDE.StatusBar = "Block deleted";
  844.           return;
  845.          }
  846.    }
  847.    return .DeleteChar(1);
  848. }
  849.  
  850. on editor:>DeleteChar(declare numToDelete) {
  851.    return .TopView.Position.Delete(numToDelete);
  852. }
  853.  
  854. on editor:>BackspaceDelete(declare numToDelete) {
  855.    declare eb = .BlockExists();
  856.    if (eb)
  857.       eb.Reset();
  858.    .TopView.Position.BackspaceDelete(numToDelete);
  859. }
  860.  
  861. on editor:>DeleteLine(moveToBOL) {
  862.    declare EditBlock theBlock(.TopView);
  863.    SetBlockStyle(LINE_BLOCK);
  864.    theBlock.Delete();
  865.  
  866.    if (moveToBOL) {
  867.       .TopView.Position.MoveBOL();
  868.    }
  869. }
  870.  
  871. on editor:>ModalDeleteLine(moveToBOL) {
  872.    declare EditBlock theBlock(.TopView);
  873.    SetBlockStyle(LINE_BLOCK);
  874.    theBlock.Delete();
  875.  
  876.    if (moveToBOL) {
  877.       .ModalMoveBOL();
  878.    }
  879. }
  880.  
  881. on editor:>DeleteToEOL(declare emacsStyle, declare append) {
  882.    declare thePos = .TopView.Position;
  883.    declare endRow = thePos.Row;
  884.    declare endCol = thePos.Column;
  885.    declare EditBlock theBlock(.TopView);
  886.    declare rv = "";
  887.  
  888.    declare nColumnCorrection = .TopView.LeftColumn;
  889.  
  890.    thePos.MoveEOL();
  891.  
  892.    // see if we are already at (or past) the end
  893.    if (thePos.Column <= endCol) {
  894.       if (!emacsStyle) {
  895.          // restore the position and leave
  896.          thePos.Move(endRow, endCol);
  897.       } else {
  898.          // pull the next line up a row
  899.          thePos.Save();
  900.  
  901.          SetBlockStyle(INCLUSIVE_BLOCK);
  902.          theBlock.Extend(endRow, endCol);
  903.          rv = theBlock.Text;
  904.          theBlock.Cut(append);
  905.  
  906.          thePos.Restore();
  907.       }
  908.    } else {
  909.       // delete remainder of line
  910.       thePos.MoveRelative(0, -1);
  911.       SetBlockStyle(INCLUSIVE_BLOCK);
  912.       theBlock.Extend(endRow, endCol);
  913.       rv = theBlock.Text;
  914.       if (emacsStyle)
  915.          theBlock.Cut(append);
  916.       else
  917.          theBlock.Delete();
  918.    }
  919.  
  920.    if (nColumnCorrection != .TopView.LeftColumn) {
  921.       .TopView.Scroll(0, (.TopView.LeftColumn - nColumnCorrection) * -1 );
  922.    }
  923.  
  924.    return rv;
  925. }
  926.  
  927. on editor:>DeleteToBOL() {
  928.  
  929.    declare eb = .BlockExists();
  930.  
  931.    if (eb != NULL) {
  932.        eb.Save();
  933.    }
  934.  
  935.    ResetBlock();
  936.    EndBlock();
  937.    .TopView.Position.MoveBOL();
  938.    BeginBlock(EXCLUSIVE_BLOCK).Delete();
  939.    ResetBlock();
  940.  
  941.    if (eb != NULL) {
  942.        eb.Restore();
  943.    }
  944. }
  945.  
  946. //
  947. // Returns the text for the 'current' word without affecting the block
  948. // state or position
  949. //
  950. on editor:>GetWord() {
  951.  
  952.    if(!initialized(.TopView)){
  953.       // no edit window exists, can't rip anything
  954.       return "";
  955.    }
  956.  
  957.    declare theBlock = .BlockExists();
  958.    declare thePos = .TopView.Position;
  959.  
  960.    if (theBlock != NULL)
  961.       if (theBlock.Size > 0) {
  962.           declare chkStr = new String(theBlock.Text);
  963.  
  964.           // if there are nothing but alphanumeric characters in the
  965.           // block, assume the block is what they want.
  966.           // if (!chkStr.Contains("", INVERT_LEGAL_CHARS |
  967.           // INCLUDE_ALPHA_CHARS | INCLUDE_NUMERIC_CHARS))
  968.           return theBlock.Text;
  969.       }
  970.  
  971.    //
  972.    // Bug fix for B50-31615 [SQF]
  973.    //
  974.    declare ep = .TopView.Position;
  975.    if (!ep.IsWordCharacter) {
  976.       return new String( "" ).Text;
  977.    }
  978.  
  979.    thePos.Save();
  980.    if (theBlock != NULL)
  981.        theBlock.Save();
  982.  
  983.    declare rv = new String(.MarkWord().Text);
  984.    declare crlf = new String("\n");
  985.    declare fixup = rv.Index(crlf.Text);
  986.    if (fixup)
  987.       rv = rv.SubString(0,fixup-2);
  988.  
  989.    thePos.Restore();
  990.    ResetBlock();
  991.    if (theBlock != NULL)
  992.        theBlock.Restore();
  993.  
  994.    return rv.Text;
  995. }
  996.  
  997. //
  998. // Returns the text for the current line without affecting the block
  999. // state or position
  1000. //
  1001. on editor:>GetLine() {
  1002.    declare thePos = .TopView.Position;
  1003.  
  1004.    thePos.Save();
  1005.    thePos.MoveBOL();
  1006.    declare rv = thePos.Read();
  1007.    thePos.Restore();
  1008.  
  1009.    return rv;
  1010. }
  1011.  
  1012. //
  1013. // Marks and returns the EditBlock representing the current word.
  1014. //
  1015. on editor:>MarkWord() {
  1016.    declare ep = .TopView.Position;
  1017.    declare theBlock = .TopView.Block;
  1018.  
  1019.    if (ep.IsWordCharacter) {
  1020.       ep.MoveCursor(SKIP_LEFT | SKIP_WORD);
  1021.    }
  1022.  
  1023.    if (ep.IsWhiteSpace) {
  1024.       ep.MoveCursor(SKIP_RIGHT | SKIP_WHITE);
  1025.    }
  1026.  
  1027.    if (!ep.IsWhiteSpace) {
  1028.       if (!ep.IsWordCharacter) {
  1029.          ep.MoveCursor(SKIP_RIGHT | SKIP_NONWORD);
  1030.       }
  1031.  
  1032.       if (ep.IsWordCharacter) {
  1033.          theBlock.Reset();
  1034.          SetBlockStyle(EXCLUSIVE_BLOCK);
  1035.          theBlock.Begin();
  1036.          ep.MoveCursor(SKIP_RIGHT | SKIP_WORD);
  1037.          theBlock.End();
  1038.       }
  1039.    }
  1040.    return theBlock;
  1041. }
  1042.  
  1043.  
  1044. on editor:>DeleteWord(declare toLeft) {
  1045.    if (toLeft) {
  1046.       .MoveCursorToWordLeft();
  1047.    }
  1048.  
  1049.    .MarkWord().Delete();
  1050. }
  1051.  
  1052. on editor:>LowerWord() {
  1053.    .TopView.BookmarkRecord(BOOKMARK_ID_SYSTEM_ONE);
  1054.    .MarkWord().LowerCase();
  1055.    .TopView.BookmarkGoto(BOOKMARK_ID_SYSTEM_ONE);
  1056.    .TopView.Block.Reset();
  1057. }
  1058.  
  1059. on editor:>UpperWord() {
  1060.    .TopView.BookmarkRecord(BOOKMARK_ID_SYSTEM_ONE);
  1061.    .MarkWord().UpperCase();
  1062.    .TopView.BookmarkGoto(BOOKMARK_ID_SYSTEM_ONE);
  1063.    .TopView.Block.Reset();
  1064. }
  1065.  
  1066. //
  1067. // Mark the current line.
  1068. //
  1069. on editor:>MarkLine() {
  1070.    .TopBuffer.Block.StartingRow = .TopView.Position.Row;
  1071.    SetBlockStyle(LINE_BLOCK);
  1072. }
  1073.  
  1074. //
  1075. // Deletes block and blocks contents.
  1076. //
  1077. on editor:>Clear() {
  1078.    declare eb = .BlockExists();
  1079.    if (eb != NULL) {
  1080.       eb.Delete();
  1081.    } else
  1082.       IDE.ReportError("No marked block");
  1083. }
  1084.  
  1085. //
  1086. // Copy currently selected block.
  1087. //
  1088. on editor:>Copy() {
  1089.    declare eb = .BlockExists();
  1090.    if (eb != NULL) {
  1091.       CopyBlock(eb,false,true);
  1092.    } else
  1093.       IDE.ReportError("No marked block");
  1094. }
  1095.  
  1096. //
  1097. // Cut currently selected block.
  1098. //
  1099. on editor:>Cut() {
  1100.    declare eb = .BlockExists();
  1101.  
  1102.    if (eb != NULL) {
  1103.       RemoveBlock(eb);
  1104.    } else
  1105.       IDE.ReportError("No marked block");
  1106. }
  1107.  
  1108. //
  1109. // Moves block into the buffer at the current cursor location
  1110. //
  1111. on editor:>MoveBlock() {
  1112.    declare eb = .BlockExists();
  1113.    if (eb != NULL) {
  1114.       eb.Cut();
  1115.       .TopView.Position.InsertScrap();
  1116. // gmc revisit: the InsertBlock method doesn't work, so we do it with
  1117. //     Cut/Paste .TopView.Position.InsertBlock(aBlock);
  1118.       IDE.StatusBar = "Block moved";
  1119.    } else {
  1120.       IDE.ReportError("No marked block");
  1121.    }
  1122. }
  1123.  
  1124. //
  1125. // Paste current scrap buffer into current buffer.
  1126. //
  1127. on editor:>Paste() {
  1128.    .TopView.Position.InsertScrap();
  1129.    IDE.StatusBar = "Scrap inserted";
  1130. }
  1131.  
  1132. //
  1133. // Selects entire contents of a file.
  1134. //
  1135. on editor:>SelectAll() {
  1136.    .TopView.Position.Move(1,1);
  1137.    .TopView.Block.Reset();
  1138.    .MarkToEOF ();
  1139. }
  1140.  
  1141. //----------------------------------------------------------------------------
  1142. // Methods for doing Block manipulations.
  1143. //----------------------------------------------------------------------------
  1144.  
  1145. //
  1146. // Change all characters in the block to lowercase.
  1147. //
  1148. on editor:>BlockLower() {
  1149.    .TopView.Block.LowerCase();
  1150. }
  1151.  
  1152. //
  1153. // Change all characters in the block to uppercase.
  1154. //
  1155. on editor:>BlockUpper() {
  1156.    .TopView.Block.UpperCase();
  1157. }
  1158.  
  1159. //
  1160. // Delete the current block.
  1161. //
  1162. on editor:>BlockDelete() {
  1163.    .TopView.Block.Delete();
  1164. }
  1165.  
  1166. //
  1167. // Save the contents of a block in the specified file.
  1168. //
  1169. on editor:>BlockSave() {
  1170.    .TopView.Block.SaveToFile();
  1171. }
  1172.  
  1173. //
  1174. // Start block at current position.
  1175. //
  1176. on editor:>StartBlock(declare type) {
  1177.    declare eb = .BlockExists();
  1178.    if (eb == NULL) {
  1179.       BeginBlock(type,TRUE);
  1180.       return;
  1181.    }
  1182.  
  1183.    // If our current position is past the endpoint, we need to reset
  1184.    // the block so we don't get leftovers on the display.
  1185.    declare ep = .TopView.Position;
  1186.  
  1187.    if ((ep.Row > eb.EndingRow) ||
  1188.       ((ep.Row == eb.EndingRow) &&
  1189.          (ep.Column >= eb.EndingColumn))) {
  1190.       ResetBlock(type);
  1191.    } else {
  1192.       BeginBlock(type);
  1193.    }
  1194. }
  1195.  
  1196. //
  1197. // End block at current position.
  1198. //
  1199. on editor:>StopBlock(declare type) {
  1200.    declare eb = .BlockExists();
  1201.    if ( eb == NULL) {
  1202.       EndBlock();
  1203.       return;
  1204.    }
  1205.  
  1206.    // If our current position is before the startpoint, we need to
  1207.    // reset the block so we don't get leftovers on the display.
  1208.    declare ep = .TopView.Position;
  1209.  
  1210.    if ( (ep.Row < eb.StartingRow) ||
  1211.       ((ep.Row == eb.StartingRow) &&
  1212.          (ep.Column <= eb.StartingColumn))) {
  1213.       ResetBlock(type);
  1214.    } else {
  1215.       EndBlock();
  1216.    }
  1217. }
  1218.  
  1219. //
  1220. // Indent block in the specified direction.
  1221. //
  1222. on editor:>SlideBlock(backward) {
  1223.    declare eb = .BlockExists();
  1224.    if (eb != NULL) {
  1225.       declare nIndent = .Options.BlockIndent;
  1226.       if (backward) {
  1227.          nIndent = nIndent * -1;
  1228.       }
  1229.       eb.Indent(nIndent);
  1230.    } else
  1231.       IDE.StatusBar = "No block exists";
  1232. }
  1233.  
  1234. //
  1235. // Toggle the visibility of a block.
  1236. //
  1237. on editor:>ToggleBlock() {
  1238.    .TopView.Block.Hide = !(.TopView.Block.Hide);
  1239. }
  1240.  
  1241. //
  1242. // Write out block.
  1243. //
  1244. on editor:>Write() {
  1245.         declare eb = .BlockExists();
  1246.  
  1247.         if (eb != NULL){
  1248.                 if (eb.Size != 0) {
  1249.                         return eb.SaveToFile();
  1250.                 }
  1251.    }
  1252.  
  1253.   return FALSE;
  1254. }
  1255.  
  1256. //----------------------------------------------------------------------------
  1257. // Methods for handling buffer operations.
  1258. //----------------------------------------------------------------------------
  1259.  
  1260. //
  1261. // Deletes current buffer.
  1262. //
  1263. on editor:>DeleteBuffer() {
  1264.  
  1265.    if (initialized(.TopBuffer)) {
  1266.       if (initialized(.TopView)) {
  1267.  
  1268.          declare curBuf = .TopBuffer;
  1269.          declare curView = .TopView;
  1270.  
  1271.          if (curView != NULL && curView.IsValid == true) {
  1272.  
  1273.             if (curBuf.IsModified == true) {
  1274.                declare theMsg = FormatString("Buffer \"%1\" has been modified, delete anyway?", curBuf.FullName);
  1275.                if (IDE.YesNoDialog(theMsg, "No") != "Yes")
  1276.                   return;
  1277.             }
  1278.  
  1279.             declare nextBuffer = curBuf.NextBuffer();
  1280.  
  1281.             if (nextBuffer.FullName != curBuf.FullName) {
  1282.                curView.Attach(nextBuffer);
  1283.  
  1284.                if (curBuf.Destroy() == false)
  1285.                   IDE.StatusBar = FormatString("Existing views on \"%1\" still exist", curBuf.FullName);
  1286.                else
  1287.                   IDE.StatusBar = FormatString("Buffer %1 activated", nextBuffer.Describe());
  1288.             }
  1289.          }
  1290.       }
  1291.    }
  1292. }
  1293.  
  1294. //
  1295. // Switches current view to the next buffer.
  1296. //
  1297. on editor:>NextBuffer() {
  1298.    declare curView = .TopView;
  1299.    if (curView != NULL && curView.IsValid == TRUE) {
  1300.       declare curBuf = .TopBuffer;
  1301.       declare nextBuffer = curBuf.NextBuffer();
  1302.       if (nextBuffer.FullName != curBuf.FullName) {
  1303.          curView.Attach(nextBuffer);
  1304.          IDE.StatusBar = FormatString("Buffer %1 activated", nextBuffer.Describe());
  1305.       }else{
  1306.          IDE.StatusBar = "No other buffers";
  1307.       }
  1308.    }
  1309. }
  1310.  
  1311. //
  1312. // Switches current view to the previous buffer.
  1313. //
  1314. on editor:>PreviousBuffer() {
  1315.    declare curView = .TopView;
  1316.    if (curView != NULL && curView.IsValid == TRUE) {
  1317.       declare curBuf = .TopBuffer;
  1318.       declare priorBuffer = curBuf.PriorBuffer();
  1319.       if (priorBuffer.FullName != curBuf.FullName) {
  1320.          curView.Attach(priorBuffer);
  1321.          IDE.StatusBar = FormatString("Buffer %1 activated", priorBuffer.Describe());
  1322.       }
  1323.    }
  1324. }
  1325.  
  1326. //
  1327. // Read file into current buffer.
  1328. //
  1329. on editor:>ReadFileIntoBuffer() {
  1330.  
  1331.    declare sFileName = new String(IDE.FileDialog("File to read:","*.*"));
  1332.  
  1333.    if (sFileName.Text != "" && IDE.IsLegalFileName(sFileName.Text)) {
  1334.       .TopView.Position.InsertFile(sFileName.Text);
  1335.       IDE.StatusBar = "File Read.";
  1336.    }
  1337. }
  1338.  
  1339. //
  1340. // Open file specified from the context of the current cursor
  1341. // location.
  1342. //
  1343. on editor:>OpenFileAtCursor() {
  1344.    LoadFileAtCursor();
  1345. }
  1346.  
  1347. //----------------------------------------------------------------------------
  1348. // Methods controlling Search/Replace.
  1349. //----------------------------------------------------------------------------
  1350.  
  1351. //
  1352. // Set the direction to the specified value.
  1353. // Depends upon the the value of SEARCH_FORWARD being 0.
  1354. //
  1355. on editor:>Search(declare direction) {
  1356.    if (initialized(direction)) {
  1357.       .SearchOptions.GoForward = !(direction == SEARCH_BACKWARD);
  1358.    }
  1359. }
  1360.  
  1361. //
  1362. // Invoke the search/replace dialog defaulting the direction to the
  1363. // specified value.
  1364. //
  1365. // Depends upon the the value of SEARCH_FORWARD being 0.
  1366. //
  1367. on editor:>Replace(declare direction) {
  1368.    if (initialized(direction)) {
  1369.       .SearchOptions.GoForward = !(direction == SEARCH_BACKWARD);
  1370.    }
  1371. }
  1372.  
  1373. //----------------------------------------------------------------------------
  1374. // Methods controlling option settings.
  1375. //----------------------------------------------------------------------------
  1376.  
  1377. //
  1378. // Toggles buffers insert mode.
  1379. //
  1380. on editor:>ToggleInsertMode() {
  1381.  
  1382.    declare EditStyle es;
  1383.    es.EditMode.BufferOptions.InsertMode = !es.EditMode.BufferOptions.InsertMode;
  1384.    .ApplyStyle(es);
  1385. }
  1386.  
  1387. //
  1388. // Toggles buffers create backup.
  1389. //
  1390. on editor:>ToggleCreateBackup() {
  1391.  
  1392.    // Togggle backup option.
  1393.    .Options.BufferOptions.CreateBackup = !.Options.BufferOptions.CreateBackup;
  1394.  
  1395.    // Notify user.
  1396.    if (.Options.BufferOptions.CreateBackup) {
  1397.       IDE.StatusBar = "Backup files will be created.";
  1398.    } else {
  1399.       IDE.StatusBar = "Backup files will not be created.";
  1400.    }
  1401. }
  1402.  
  1403. //
  1404. // Toggles use of regualr expressions during searches.
  1405. //
  1406. on editor:>ToggleRegularExpression() {
  1407.  
  1408.    // Togggle regular expressions option.
  1409.    .SearchOptions.RegularExpression = !.SearchOptions.RegularExpression;
  1410.  
  1411.    // Notify user.
  1412.    if (.SearchOptions.RegularExpression) {
  1413.       IDE.StatusBar = "Regular expressions on.";
  1414.    } else {
  1415.       IDE.StatusBar = "Regular expressions off.";
  1416.    }
  1417. }
  1418.  
  1419. //
  1420. // Toggles use of case during searches.
  1421. //
  1422. on editor:>ToggleSearchCase() {
  1423.    // Togggle case sensitive option.
  1424.    .SearchOptions.CaseSensitive = !.SearchOptions.CaseSensitive;
  1425.  
  1426.    // Notify user.
  1427.    if (.SearchOptions.CaseSensitive) {
  1428.       IDE.StatusBar = "Case sensitivitiy on.";
  1429.    } else {
  1430.       IDE.StatusBar = "Case sensitivitiy off.";
  1431.    }
  1432. }
  1433.  
  1434.  
  1435. //----------------------------------------------------------------------------
  1436. // Methods controlling miscellaneous operations.
  1437. //----------------------------------------------------------------------------
  1438.  
  1439. //
  1440. // Invoke printing dialog.
  1441. //
  1442. on editor:>Print() {
  1443.    .TopBuffer.Print();
  1444. }
  1445.  
  1446. //
  1447. // Split line at current cursor location and continue editing.
  1448. //
  1449. on editor:>OpenLine() {
  1450.    declare ep = .TopView.Position;
  1451.    ep.Save();
  1452.    ep.InsertCharacter(10);
  1453.    ep.Restore();
  1454. }
  1455.  
  1456. //
  1457. // Get the next key for literal insertion.
  1458. //
  1459.  
  1460. declare kbdNextKey = NULL;
  1461.  
  1462. on editor:>InsertLiteralKeyNext() {
  1463.    if (kbdNextKey == NULL) {
  1464.       kbdNextKey = new Keyboard(FALSE);
  1465.       kbdNextKey.DefaultAssignment = "editor.InsertLiteralKeyPress();";
  1466.    }
  1467.  
  1468.    IDE.KeyboardManager.Push(kbdNextKey, "Editor", FALSE);
  1469.    bPopEditorKeyboard = true;
  1470.    IDE.StatusBar = "Inserting literal key.";
  1471. }
  1472.  
  1473. on editor:>InsertLiteralKeyPress() {
  1474.  
  1475.    declare nKey = IDE.KeyboardManager.LastKeyProcessed;
  1476.  
  1477.    .TopView.Position.InsertCharacter(nKey);
  1478.  
  1479.    IDE.StatusBar = "Literal key inserted.";
  1480.    IDE.KeyboardManager.Pop("Editor");
  1481.    bPopEditorKeyboard = false;
  1482. }
  1483.  
  1484. //
  1485. // Set the specified bookmark to the current location.
  1486. //
  1487. on editor:>SetBookmark(declare whichOne) {
  1488.    if (.TopView.BookmarkRecord(whichOne))
  1489.       IDE.StatusBar = FormatString("Bookmark %1 dropped.", whichOne);
  1490.    else
  1491.       IDE.ReportError("Unable to drop bookmark.");
  1492. }
  1493.  
  1494. //
  1495. // Goto the specified bookmark location.
  1496. //
  1497.  
  1498. declare kbdGotoBookmark = NULL;
  1499.  
  1500. on editor:>GotoBookmark(declare nBookmarkId) {
  1501.  
  1502.    if (!initialized(nBookmarkId)) {
  1503.        if (kbdGotoBookmark == NULL) {
  1504.            kbdGotoBookmark = new Keyboard(FALSE);
  1505.            kbdGotoBookmark.Assign("<0>","editor.GotoBookmarkSelect(0);");
  1506.            kbdGotoBookmark.Assign("<1>","editor.GotoBookmarkSelect(1);");
  1507.            kbdGotoBookmark.Assign("<2>","editor.GotoBookmarkSelect(2);");
  1508.            kbdGotoBookmark.Assign("<3>","editor.GotoBookmarkSelect(3);");
  1509.            kbdGotoBookmark.Assign("<4>","editor.GotoBookmarkSelect(4);");
  1510.            kbdGotoBookmark.Assign("<5>","editor.GotoBookmarkSelect(5);");
  1511.            kbdGotoBookmark.Assign("<6>","editor.GotoBookmarkSelect(6);");
  1512.            kbdGotoBookmark.Assign("<7>","editor.GotoBookmarkSelect(7);");
  1513.            kbdGotoBookmark.Assign("<8>","editor.GotoBookmarkSelect(8);");
  1514.            kbdGotoBookmark.Assign("<9>","editor.GotoBookmarkSelect(9);");
  1515.  
  1516.            kbdGotoBookmark.DefaultAssignment = "editor.GotoBookmarkSelect();";
  1517.        }
  1518.  
  1519.        IDE.KeyboardManager.Push(kbdGotoBookmark, "Editor", FALSE);
  1520.        bPopEditorKeyboard = true;
  1521.        IDE.StatusBar = "Go to Bookmark [1-10]:";
  1522.  
  1523.    } else {
  1524.  
  1525.        declare result = .TopView.BookmarkGoto(nBookmarkId);
  1526.  
  1527.        if (result) {
  1528.            .TopView.Position.MoveRelative(0,0);
  1529.        }  else
  1530.            IDE.ReportError(FormatString("Bookmark %1 doesn't exist.", nBookmarkId));
  1531.    }
  1532. }
  1533.  
  1534. on editor:>GotoBookmarkSelect(declare nBookmarkId) {
  1535.  
  1536.    if (initialized(nBookmarkId)) {
  1537.        declare eb = .BlockExists();
  1538.        declare ep = .TopView.Position;
  1539.  
  1540.        if (eb != NULL) {
  1541.            eb.Save();
  1542.            ep.Save();
  1543.        }
  1544.  
  1545.        declare result = .TopView.BookmarkGoto(nBookmarkId);
  1546.  
  1547.        if (result) {
  1548.            if (eb != NULL) {
  1549.                declare nRow = ep.Row;
  1550.                declare nColumn = ep.Column;
  1551.  
  1552.                ep.Restore();
  1553.                eb.Restore();
  1554.  
  1555.                eb.Extend(nRow,nColumn);
  1556.  
  1557.            } else {
  1558.                 // Force repositioning of the view...
  1559.                 ep.MoveRelative(0,0);
  1560.            }
  1561.  
  1562.            IDE.StatusBar = "";
  1563.  
  1564.        } else
  1565.                  IDE.ReportError(FormatString("Bookmark %1 doesn't exist.", nBookmarkId));
  1566.    } else
  1567.         IDE.StatusBar = "";
  1568.  
  1569.   IDE.KeyboardManager.Pop("Editor");
  1570.   bPopEditorKeyboard = false;
  1571. }
  1572.  
  1573. //
  1574. // Move cursor forward one tab stop.
  1575. //
  1576. on editor:>SmartTab() {
  1577.    .TopView.Position.Align(1);
  1578. }
  1579.  
  1580. //
  1581. // Backup cursor position one tab stop.
  1582. //
  1583. on editor:>BackTab() {
  1584.    .TopView.Position.Tab(-1);
  1585. }
  1586.  
  1587. //
  1588. // Move cursor forward one tab stop.
  1589. //
  1590. on editor:>Tab() {
  1591.    .TopView.Position.Tab(1);
  1592. }
  1593.  
  1594. //
  1595. // Save all buffers and exit IDE.
  1596. //
  1597. on editor:>SaveAllAndExit() {
  1598.    IDE.FileSaveAll();
  1599.    IDE.FileExit();
  1600. }
  1601.  
  1602. on editor:>Undo() {
  1603.    .ViewUndo(.TopView);
  1604. }
  1605.  
  1606. on editor:>Redo() {
  1607.    .ViewRedo(.TopView);
  1608. }
  1609.  
  1610. on editor:>ToggleCase() {
  1611.    .TopView.Block.ToggleCase();
  1612. }
  1613.  
  1614. //----------------------------------------------------------------------------
  1615. // Methods for extending editor operations.
  1616. //----------------------------------------------------------------------------
  1617.  
  1618. //
  1619. // Determines if the blocks start is before the cursor position.
  1620. //
  1621. StartBlockBeforeCursor(declare editBlock, declare editPosition) {
  1622.    // Block's row is before cursors row.
  1623.    if (editBlock.StartingRow < editPosition.Row)
  1624.       return TRUE;
  1625.  
  1626.    // Block's row is after cursors row.
  1627.    if (editBlock.StartingRow > editPosition.Row)
  1628.       return FALSE;
  1629.  
  1630.    // We're on the same row.  Block's column is before cursors column.
  1631.    if (editBlock.StartingColumn < editPosition.Column)
  1632.       return TRUE;
  1633.  
  1634.    // Block's column is after cursors column.
  1635.    if (editBlock.StartingColumn > editPosition.Column)
  1636.       return FALSE;
  1637.  
  1638.    // We're on the same row & column.
  1639.    return FALSE;
  1640. }
  1641.  
  1642. //
  1643. // Begins incremental searching of current buffer.
  1644. //
  1645. declare ISearchKbd = NULL;
  1646. declare ISearchString = "";
  1647. declare ISearchDirection = SEARCH_FORWARD;
  1648.  
  1649. on editor:>IncrementalSearch(declare direction) {
  1650.  
  1651.    if (ISearchKbd == NULL) {
  1652.        ISearchKbd = new Keyboard(false);      // not transparent
  1653.        ISearchKbd.Assign("<Backspace>","editor.ISearchBackspace();");
  1654.        ISearchKbd.Assign("<Space>","editor.ISearchSpecial(\"< >\");");
  1655.        ISearchKbd.Assign("<Minus>","editor.ISearchSpecial(\"<->\");");
  1656.        ISearchKbd.Assign("<~>","editor.ISearchSpecial(\"<~>\");");
  1657.        ISearchKbd.Assign("<Shift-.>","editor.ISearchSpecial(\"<>>\");");
  1658.        ISearchKbd.Assign("<Shift-,>","editor.ISearchSpecial(\"<<>\");");
  1659.        ISearchKbd.Assign("<Ctrl-g>","IDE.KeyboardManager.SendKeys(\"{VK_ESCAPE}\");");
  1660.        ISearchKbd.Assign("<Ctrl-r>","editor.ISearchBackward();");
  1661.        ISearchKbd.Assign("<Ctrl-s>","editor.ISearchForward();");
  1662.        ISearchKbd.Assign("<Ctrl-c>","editor.ISearchCaseSensitive();");
  1663.        ISearchKbd.Assign("<Ctrl-e>","editor.ISearchRegularExpressions();");
  1664.        ISearchKbd.DefaultAssignment = "editor.ISearchKey();";
  1665.    }
  1666.  
  1667.    if (initialized(direction))
  1668.       ISearchDirection = direction;
  1669.    else {
  1670.        if (.SearchOptions.GoForward)
  1671.           ISearchDirection = SEARCH_FORWARD;
  1672.        else
  1673.           ISearchDirection = SEARCH_BACKWARD;
  1674.    }
  1675.  
  1676.    declare keySequence = IDE.KeyboardManager.GetKeyboard("Desktop").GetKeySequence("IDE.SearchSearchAgain();");
  1677.    ISearchKbd.Assign(keySequence,"editor.ISearchEndAndSearchAgain();");
  1678.  
  1679.  
  1680.    IDE.KeyboardManager.Push(ISearchKbd, "Editor", false);
  1681.    bPopEditorKeyboard = true;
  1682.    ISearchString = "";
  1683.    .ISearchDisplayStatus();
  1684. }
  1685.  
  1686. //
  1687. // Performs incremental searching of current buffer.
  1688. //
  1689. on editor:>ISearch(declare acKey) {
  1690.  
  1691.    declare ep = .TopView.Position;
  1692.    declare sKey = new String(acKey);
  1693.    sKey = sKey.SubString(1, 1);
  1694.  
  1695.       if ((IDE.KeyboardManager.KeyboardFlags & 0x03) && // Shift is pressed...
  1696.        sKey.Character > 96 &&                        // It's between lower case 'a'
  1697.        sKey.Character < 123)                         // and a 'z'
  1698.        sKey.Character -= 32;
  1699.  
  1700.    // Move the cursor back before the highlight to search again from the
  1701.    // begining of the highlight when searching forward.
  1702.    if (ISearchDirection == SEARCH_FORWARD)
  1703.        ep.MoveRelative(0,-(new String(ISearchString).Length));
  1704.  
  1705.    // Add the new key to the search string.
  1706.    ISearchString = ISearchString + sKey.Text;
  1707.  
  1708.    if (ISearchDirection == SEARCH_BACKWARD)
  1709.       ep.MoveRelative(0,new String(ISearchString).Length);
  1710.  
  1711.    // Search for the search string...
  1712.    // If this fails go back to the previous search string and
  1713.    //   search for the last known successful string.
  1714.    if (ISearchDirection == SEARCH_FORWARD && .SearchOptions.RegularExpression)
  1715.       ep.MoveRelative(0,-(new String(ISearchString).Length));
  1716.  
  1717.    if (!.ISearchAgain()) {
  1718.       declare String CS(ISearchString);
  1719.       ISearchString = CS.SubString(0, CS.Length - 1).Text;
  1720.       if (.SearchOptions.RegularExpression)
  1721.          ep.Search("\\c"+ISearchString, .SearchOptions.CaseSensitive, true, ISearchDirection,BRIEF_RE);
  1722.       else {
  1723.          ep.Search(ISearchString, .SearchOptions.CaseSensitive, false, ISearchDirection);
  1724.       }
  1725.    }
  1726.  
  1727.    .SearchOptions.SearchText = ISearchString;
  1728.  
  1729.    .ISearchDisplayStatus();
  1730. }
  1731.  
  1732.  
  1733. on editor:>ISearchBackward() {
  1734.    if (ISearchDirection == SEARCH_BACKWARD)
  1735.       .ISearchAgain(true);
  1736.    else
  1737.       {
  1738.        ISearchDirection = SEARCH_BACKWARD;
  1739.        .ISearchAgain(true);
  1740.        if (!.SearchOptions.RegularExpression)
  1741.           .ISearchAgain(true);
  1742.       }
  1743.    .ISearchDisplayStatus();
  1744.  
  1745. }
  1746.  
  1747. on editor:>ISearchDisplayStatus() {
  1748.  
  1749.    declare sbMessage = "I-Search ";
  1750.  
  1751.    if (ISearchDirection == SEARCH_FORWARD)
  1752.       sbMessage = sbMessage + "(frwd";
  1753.    else
  1754.       sbMessage = sbMessage + "(bkwd";
  1755.  
  1756.  
  1757.    if (.SearchOptions.RegularExpression)
  1758.       sbMessage = sbMessage + ",re";
  1759.  
  1760.    if (.SearchOptions.CaseSensitive)
  1761.       sbMessage = sbMessage + ",cs";
  1762.  
  1763.    IDE.StatusBar = sbMessage + " ) for:" + ISearchString+ "     [Ctrl-s=Frwd Ctrl-r=Rvrs Ctrl-c=Case Ctrl-e=RE] ";
  1764. }
  1765.  
  1766. on editor:>ISearchForward() {
  1767.    if (ISearchDirection == SEARCH_FORWARD)
  1768.       .ISearchAgain(true);
  1769.    else
  1770.       {
  1771.        ISearchDirection = SEARCH_FORWARD;
  1772.        .ISearchAgain(true);
  1773.       }
  1774.    .ISearchDisplayStatus();
  1775. }
  1776.  
  1777. on editor:>ISearchAgain(declare bStep) {
  1778.  
  1779.    declare ep = .TopView.Position;
  1780.  
  1781.    if (initialized(bStep))
  1782.       if (bStep && ISearchDirection == SEARCH_FORWARD)
  1783.          ep.MoveRelative(0,new String(ISearchString).Length);
  1784.  
  1785.    declare result;
  1786.  
  1787.    if (.SearchOptions.RegularExpression)
  1788.       result = ep.Search("\\c"+ISearchString, .SearchOptions.CaseSensitive, true, ISearchDirection,BRIEF_RE);
  1789.    else
  1790.       result = ep.Search(ISearchString, .SearchOptions.CaseSensitive, false, ISearchDirection);
  1791.  
  1792.    if (!result) {
  1793.       if (bStep) {
  1794.          if (ISearchDirection == SEARCH_FORWARD)
  1795.             {
  1796.              if (.SearchOptions.RegularExpression)
  1797.                 ep.MoveRelative(0,-(new String(ISearchString).Length));
  1798.             }
  1799.            else
  1800.               ep.MoveRelative(0,new String(ISearchString).Length);
  1801.  
  1802.          if (.SearchOptions.RegularExpression)
  1803.             ep.Search("\\c"+ISearchString, .SearchOptions.CaseSensitive, true, ISearchDirection,BRIEF_RE);
  1804.          else {
  1805.             ep.Search(ISearchString, .SearchOptions.CaseSensitive, false, ISearchDirection);
  1806.          }
  1807.       }
  1808.       IDE.MessageBeep();
  1809.    }
  1810.  
  1811.    return result;
  1812. }
  1813.  
  1814.  
  1815. //
  1816. // Undoes the last incremental search.
  1817. //
  1818.  
  1819. on editor:>ISearchBackspace() {
  1820.  
  1821.    declare ep = .TopView.Position;
  1822.  
  1823.    // Move the cursor back before the highlight to search again from the
  1824.    // begining of the highlight when searching forward.
  1825.  
  1826.    declare String CS(ISearchString);
  1827.  
  1828.    if (CS.Length <= 1) {
  1829.       if (CS.Length == 1 && ISearchDirection == SEARCH_FORWARD && !.SearchOptions.RegularExpression)
  1830.           ep.MoveRelative(0,-1);
  1831.       ISearchString = "";
  1832.       ep.Move(ep.Row, ep.Column);
  1833.    } else {
  1834.       if (ISearchDirection == SEARCH_FORWARD && !.SearchOptions.RegularExpression)
  1835.           ep.MoveRelative(0,-(new String(ISearchString).Length));
  1836.       ISearchString = CS.SubString(0, CS.Length - 1).Text;
  1837.       .ISearchAgain();
  1838.    }
  1839.  
  1840.    .ISearchDisplayStatus();
  1841. }
  1842.  
  1843. //
  1844. // Ends incremental searching and performs search again.
  1845. //
  1846. on editor:>ISearchEndAndSearchAgain() {
  1847.  
  1848.    IDE.KeyboardManager.SendKeys("{VK_ESCAPE}");
  1849.    IDE.SearchSearchAgain();
  1850. }
  1851.  
  1852. //
  1853. // Processes general keys.
  1854. //
  1855.  
  1856. on editor:>ISearchKey() {
  1857.  
  1858.    declare nLastKeyProcessed = IDE.KeyboardManager.LastKeyProcessed;
  1859.  
  1860.    if ((nLastKeyProcessed < 28) || (nLastKeyProcessed > 127)) {
  1861.  
  1862.       declare String CS(ISearchString);
  1863.       if (.SearchOptions.RegularExpression)
  1864.          .TopView.Position.MoveRelative(0, CS.Length);
  1865.       IDE.KeyboardManager.Pop("Editor");
  1866.       bPopEditorKeyboard = false;
  1867.  
  1868.       IDE.StatusBar = "I-Search ended";
  1869.       return;
  1870.    }
  1871.  
  1872.    .ISearch(IDE.KeyboardManager.CodeToKey(nLastKeyProcessed));
  1873. }
  1874.  
  1875. on editor:>ISearchCaseSensitive() {
  1876.    // Togggle case sensitive option.
  1877.    .SearchOptions.CaseSensitive = !.SearchOptions.CaseSensitive;
  1878.    .ISearchDisplayStatus();
  1879. }
  1880.  
  1881. on editor:>ISearchRegularExpressions() {
  1882.    // Togggle regular expressions option.
  1883.    .SearchOptions.RegularExpression = !.SearchOptions.RegularExpression;
  1884.    .ISearchDisplayStatus();
  1885. }
  1886.  
  1887. on editor:>ISearchSpecial(declare nKey) {
  1888.  .ISearch(nKey);
  1889. }
  1890.  
  1891. //----------------------------------------------------------------------------
  1892. // Event hooks for receiving notification of options modifications.
  1893. //----------------------------------------------------------------------------
  1894.  
  1895. //
  1896. // Update editing environment to use value of persistent blocks.
  1897. //
  1898. on editor:>OptionsChanged(editOptions) {
  1899.  
  1900.    if (initialized(.TopView))
  1901.        if (.TopView != NULL)
  1902.            if (initialized(.TopView.Block))
  1903.                .TopView.Block.Style = gbStyle;
  1904.  
  1905.    pass(editOptions);
  1906. }
  1907.  
  1908. //----------------------------------------------------------------------------
  1909. // Blocking support functions.
  1910. //----------------------------------------------------------------------------
  1911.  
  1912. // The global variable screenBlock is used to represent the marked
  1913. // area in the currently active edit view.
  1914. declare screenBlock;
  1915.  
  1916. // The global variable zeroSizeBlockOkay indicates if a block which
  1917. // marks no characters should be considered valid or not.
  1918. declare zeroSizeBlockOkay = FALSE;
  1919.  
  1920. // The global varibale gbToggle keeps track of what is being toggled
  1921. // to and from and if the block should be started or ended.
  1922.  
  1923. declare gbToggle = NULL;
  1924.  
  1925. InitializeScreenBlock() {
  1926.    if (!initialized(screenBlock)) {
  1927.       screenBlock = editor.TopView.Block;
  1928.    }
  1929. }
  1930.  
  1931. //
  1932. // This event is triggered when a differant editor view is activated
  1933. // by the user.  Occurances of this event prior to the loading of this
  1934. // module are of no concern.  Once loaded, this event will keep the
  1935. // global variable screenBlock in synch with the displayed view.
  1936. //
  1937.  
  1938. on editor:>ViewActivated(newEditView) {
  1939.  
  1940.    if (IDE.KeyboardManager.GetKeyboard() == IDE.KeyboardManager.GetKeyboard("ClassExpert"))
  1941.       if (initialized(.GetWindow()))
  1942.           gewClassExpert = .GetWindow();
  1943.  
  1944.    // Perform existing behaviour
  1945.    pass(newEditView);
  1946.  
  1947.    // Reset block kill append.
  1948.    if(screenBlock != newEditView.Block){
  1949.       screenBlock = newEditView.Block;
  1950.       if (initialized(screenBlock)){
  1951.          if (!screenBlock.IsValid){
  1952.             ResetBlock();
  1953.          }
  1954.       }
  1955.    }
  1956. }
  1957.  
  1958. //
  1959. // Dynamically add the method BlockExists() to the editor instance.
  1960. // This method is called from the editor movement scripts to determine
  1961. // weather a block's dimensions should be updated or if the cursor
  1962. // ought to simply be moved.
  1963. //
  1964. on editor:>BlockExists() {
  1965.    // Since there is no such thing as an Invalid block, we interpret a
  1966.    // block to be invalid if it has not explicitly had its type set
  1967.    // AND it is of size zero AND we have not explicitly been told that
  1968.    // zero sized blocks really do count.
  1969.    if ((screenBlock.Style != EXCLUSIVE_BLOCK) || (screenBlock.Size != 0) ||
  1970.       zeroSizeBlockOkay) {
  1971.       return screenBlock;
  1972.    }
  1973.    return NULL;
  1974. }
  1975.  
  1976. declare gbMouseBlock = false;
  1977.  
  1978. on editor:>MouseBlockCreated() {
  1979.    gbMouseBlock = true;
  1980.    pass();
  1981. }
  1982.  
  1983. on editor:>MouseLeftDown() {
  1984.    SetBlockStyle(gbStyle);
  1985.    gbMouseBlock = false;
  1986.    pass();
  1987. }
  1988.  
  1989. on editor:>MouseLeftUp() {
  1990.  
  1991.    if (gbStyle != .TopView.Block.Style) {
  1992.       gbStyle = .TopView.Block.Style;
  1993.       gbToggle = true;
  1994.    }
  1995.  
  1996.    pass();
  1997.  
  1998.    if (!gbMouseBlock) {
  1999.       if (!(IDE.KeyboardManager.KeyboardFlags & 0x03))
  2000.          ResetBlock(gbStyle);
  2001.    }
  2002.  
  2003.    gbMouseBlock = false;
  2004. }
  2005.  
  2006. ToggleBlockStyle(newStyle) {
  2007.  
  2008.    InitializeScreenBlock();
  2009.  
  2010.    declare currentStyle = screenBlock.Style;
  2011.  
  2012.    switch (newStyle) {
  2013.       case COLUMN_BLOCK:
  2014.       case INCLUSIVE_BLOCK:
  2015.       case LINE_BLOCK: {
  2016.           if (currentStyle == newStyle) {
  2017.              ResetBlock();
  2018.              gbToggle = false;
  2019.              zeroSizeBlockOkay = false;
  2020.           } else {
  2021.              gbStyle = newStyle;
  2022.              screenBlock.Style = newStyle;
  2023.              gbToggle = true;
  2024.           }
  2025.        break;
  2026.       }
  2027.  
  2028.       case EXCLUSIVE_BLOCK: {
  2029.           if (currentStyle == newStyle && gbToggle) {
  2030.              ResetBlock();
  2031.              gbToggle = false;
  2032.              zeroSizeBlockOkay = false;
  2033.           } else {
  2034.              zeroSizeBlockOkay = true;
  2035.              gbStyle = newStyle;
  2036.              screenBlock.Style = newStyle;
  2037.              gbToggle = true;
  2038.           }
  2039.        break;
  2040.       }
  2041.  
  2042.    }
  2043.  
  2044.  return screenBlock;
  2045. }
  2046.  
  2047. //
  2048. // The Wordstar keymap uses these entrypoints to control it's block
  2049. //
  2050. ResetBlock(declare type) {
  2051.    if (initialized(type)) {
  2052.        declare curType = screenBlock.Style;
  2053.        if (curType == type) {
  2054.            zeroSizeBlockOkay = FALSE;
  2055.        }
  2056.    } else {
  2057.         zeroSizeBlockOkay = FALSE;
  2058.    }
  2059.  
  2060.    gbToggle = false;
  2061.    screenBlock.Reset();
  2062.    return screenBlock;
  2063. }
  2064.  
  2065. BeginBlock(declare type, declare bBlockReset) {
  2066.  
  2067.    if (!initialized(type)) {
  2068.       type = screenBlock.Style;
  2069.    }
  2070.  
  2071.    if (initialized(bBlockReset)) {
  2072.       if (bBlockReset == true) {
  2073.           screenBlock.Begin();
  2074.           SetBlockStyle(type);
  2075.           return screenBlock;
  2076.       } else {
  2077.           screenBlock.Reset();
  2078.           screenBlock.Begin();
  2079.           SetBlockStyle(type);
  2080.           return screenBlock;
  2081.       }
  2082.    } else {
  2083.       screenBlock.Reset();
  2084.       screenBlock.Begin();
  2085.       SetBlockStyle(type);
  2086.       return screenBlock;
  2087.    }
  2088.  
  2089. }
  2090.  
  2091. EndBlock() {
  2092.  screenBlock.End();
  2093.  return screenBlock;
  2094. }
  2095.  
  2096. CopyBlock(declare editBlock, declare append, declare dontReset) {
  2097.  
  2098.    // Now Copy the block.
  2099.    if (editBlock != NULL) {
  2100.       editBlock.Copy(append);
  2101.    }
  2102.  
  2103.    // Turn off the block.
  2104.    if (!initialized(dontReset))
  2105.       ResetBlock();
  2106.    else if (!dontReset)
  2107.       ResetBlock();
  2108. }
  2109.  
  2110. RemoveBlock(declare editBlock, declare bDelete) {
  2111.  
  2112.    // Now Delete or Cut the block.
  2113.    if (editBlock != NULL) {
  2114.       editor.TopView.BookmarkRecord(BOOKMARK_ID_SYSTEM_ONE);
  2115.  
  2116.       if (initialized(bDelete)) {
  2117.           if (bDelete == TRUE) {
  2118.              editBlock.Delete();
  2119.           } else {
  2120.              editBlock.Cut();
  2121.           }
  2122.        } else {
  2123.           editBlock.Cut();
  2124.        }
  2125.  
  2126.        editor.TopView.BookmarkGoto(BOOKMARK_ID_SYSTEM_ONE);
  2127.    }
  2128.  
  2129.    // Turn off the block...
  2130.    ResetBlock();
  2131. }
  2132.  
  2133. SetBlockStyle(declare blockStyle) {
  2134.    gbStyle = blockStyle;
  2135.    screenBlock.Style = blockStyle;
  2136.    gbStyle = blockStyle;
  2137.    if (blockStyle == EXCLUSIVE_BLOCK)
  2138.        zeroSizeBlockOkay = TRUE;
  2139.    else
  2140.       zeroSizeBlockOkay = FALSE;
  2141. }
  2142.  
  2143. SetZeroBlock(newVal){
  2144.  zeroSizeBlockOkay = newVal;
  2145. }
  2146.